<?php
define("EW_PAGE_ID", "view", TRUE); // Page ID
define("EW_TABLE_NAME", 'movie', TRUE);
?>
<?php 
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg50.php" ?>
<?php include "ewmysql50.php" ?>
<?php include "phpfn50.php" ?>
<?php include "movieinfo.php" ?>
<?php include "userfn50.php" ?>
<?php include "usersinfo.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Open connection to the database
$conn = ew_Connect();
?>
<?php
$Security = new cAdvancedSecurity();
?>
<?php
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
$Security->LoadCurrentUserLevel('movie');
if (!$Security->IsLoggedIn()) {
	$Security->SaveLastUrl();
	Page_Terminate("login.php");
}
if (!$Security->CanView()) {
	$Security->SaveLastUrl();
	Page_Terminate("movielist.php");
}
?>
<?php

// Common page loading event (in userfn*.php)
Page_Loading();
?>
<?php

// Page load event, used in current page
Page_Load();
?>
<?php
$movie->Export = @$_GET["export"]; // Get export parameter
$sExport = $movie->Export; // Get export parameter, used in header
$sExportFile = $movie->TableVar; // Get export file, used in header
?>
<?php
if (@$_GET["id"] <> "") {
	$movie->id->setQueryStringValue($_GET["id"]);
} else {
	Page_Terminate("movielist.php"); // Return to list page
}

// Get action
if (@$_POST["a_view"] <> "") {
	$movie->CurrentAction = $_POST["a_view"];
} else {
	$movie->CurrentAction = "I"; // Display form
}
switch ($movie->CurrentAction) {
	case "I": // Get a record to display
		if (!LoadRow()) { // Load record based on key
			$_SESSION[EW_SESSION_MESSAGE] = "No records found"; // Set no record message
			Page_Terminate("movielist.php"); // Return to list
		}
}

// Set return url
$movie->setReturnUrl("movieview.php");

// Render row
$movie->RowType = EW_ROWTYPE_VIEW;
RenderRow();
?>
<?php include "header.php" ?>
<script type="text/javascript">
<!--
var EW_PAGE_ID = "view"; // Page id
var EW_SHOW_HIGHLIGHT = "Show highlight"; 
var EW_HIDE_HIGHLIGHT = "Hide highlight";

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<p><span class="phpmaker">View TABLE: movie
<br><br>
<a href="movielist.php">Back to List</a>&nbsp;
<?php if ($Security->CanAdd()) { ?>
<a href="movieadd.php">Add</a>&nbsp;
<?php } ?>
<?php if ($Security->CanEdit()) { ?>
<a href="<?php echo $movie->EditUrl() ?>">Edit</a>&nbsp;
<?php } ?>
<?php if ($Security->CanAdd()) { ?>
<a href="<?php echo $movie->CopyUrl() ?>">Copy</a>&nbsp;
<?php } ?>
<?php if ($Security->CanDelete()) { ?>
<a href="<?php echo $movie->DeleteUrl() ?>">Delete</a>&nbsp;
<?php } ?>
</span>
</p>
<?php
if (@$_SESSION[EW_SESSION_MESSAGE] <> "") {
?>
<p><span class="ewmsg"><?php echo $_SESSION[EW_SESSION_MESSAGE] ?></span></p>
<?php
	$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message
}
?>
<p>
<form>
<table class="ewTable">
	<tr class="ewTableRow">
		<td class="ewTableHeader">id</td>
		<td<?php echo $movie->id->CellAttributes() ?>>
<div<?php echo $movie->id->ViewAttributes() ?>><?php echo $movie->id->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">mv id</td>
		<td<?php echo $movie->mv_id->CellAttributes() ?>>
<div<?php echo $movie->mv_id->ViewAttributes() ?>><?php echo $movie->mv_id->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Parent ID</td>
		<td<?php echo $movie->parent_id->CellAttributes() ?>>
<div<?php echo $movie->parent_id->ViewAttributes() ?>><?php echo $movie->parent_id->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Sub ID</td>
		<td<?php echo $movie->sub_id->CellAttributes() ?>>
<div<?php echo $movie->sub_id->ViewAttributes() ?>><?php echo $movie->sub_id->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Name</td>
		<td<?php echo $movie->mv_name->CellAttributes() ?>>
<div<?php echo $movie->mv_name->ViewAttributes() ?>><?php echo $movie->mv_name->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Name English</td>
		<td<?php echo $movie->mv_name_en->CellAttributes() ?>>
<div<?php echo $movie->mv_name_en->ViewAttributes() ?>><?php echo $movie->mv_name_en->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Small Image</td>
		<td<?php echo $movie->mv_smallimg->CellAttributes() ?>>
<?php if ($movie->mv_smallimg->HrefValue <> "") { ?>
<?php if (!is_null($movie->mv_smallimg->Upload->DbValue)) { ?>
<img src="<?php echo ew_UploadPathEx(FALSE, "../upload_img/movie/") . $movie->mv_smallimg->Upload->DbValue ?>" border=0<?php echo $movie->mv_smallimg->ViewAttributes() ?>>
<?php } ?>
<?php } else { ?>
<?php if (!is_null($movie->mv_smallimg->Upload->DbValue)) { ?>
<img src="<?php echo ew_UploadPathEx(FALSE, "../upload_img/movie/") . $movie->mv_smallimg->Upload->DbValue ?>" border=0<?php echo $movie->mv_smallimg->ViewAttributes() ?>>
<?php } ?>
<?php } ?>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Big Image</td>
		<td<?php echo $movie->mv_bigimg->CellAttributes() ?>>
<?php if ($movie->mv_bigimg->HrefValue <> "") { ?>
<?php if (!is_null($movie->mv_bigimg->Upload->DbValue)) { ?>
<img src="<?php echo ew_UploadPathEx(FALSE, "../userfiles/image/hinh phim/") . $movie->mv_bigimg->Upload->DbValue ?>" border=0<?php echo $movie->mv_bigimg->ViewAttributes() ?>>
<?php } ?>
<?php } else { ?>
<?php if (!is_null($movie->mv_bigimg->Upload->DbValue)) { ?>
<img src="<?php echo ew_UploadPathEx(FALSE, "../userfiles/image/hinh phim/") . $movie->mv_bigimg->Upload->DbValue ?>" border=0<?php echo $movie->mv_bigimg->ViewAttributes() ?>>
<?php } ?>
<?php } ?>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Content</td>
		<td<?php echo $movie->mv_content->CellAttributes() ?>>
<div<?php echo $movie->mv_content->ViewAttributes() ?>><?php echo $movie->mv_content->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Detail</td>
		<td<?php echo $movie->mv_detail->CellAttributes() ?>>
<div<?php echo $movie->mv_detail->ViewAttributes() ?>><?php echo $movie->mv_detail->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Hard Disk</td>
		<td<?php echo $movie->mv_harddisk->CellAttributes() ?>>
<div<?php echo $movie->mv_harddisk->ViewAttributes() ?>><?php echo $movie->mv_harddisk->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Path</td>
		<td<?php echo $movie->mv_path->CellAttributes() ?>>
<div<?php echo $movie->mv_path->ViewAttributes() ?>><?php echo $movie->mv_path->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Capacity</td>
		<td<?php echo $movie->mv_capacity->CellAttributes() ?>>
<div<?php echo $movie->mv_capacity->ViewAttributes() ?>><?php echo $movie->mv_capacity->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Year</td>
		<td<?php echo $movie->mv_year->CellAttributes() ?>>
<div<?php echo $movie->mv_year->ViewAttributes() ?>><?php echo $movie->mv_year->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Subtitles</td>
		<td<?php echo $movie->mv_subtitles->CellAttributes() ?>>
<div<?php echo $movie->mv_subtitles->ViewAttributes() ?>><?php echo $movie->mv_subtitles->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Resolution</td>
		<td<?php echo $movie->mv_resolution->CellAttributes() ?>>
<div<?php echo $movie->mv_resolution->ViewAttributes() ?>><?php echo $movie->mv_resolution->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Price</td>
		<td<?php echo $movie->mv_price->CellAttributes() ?>>
<div<?php echo $movie->mv_price->ViewAttributes() ?>><?php echo $movie->mv_price->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Dateadd</td>
		<td<?php echo $movie->mv_dateadd->CellAttributes() ?>>
<div<?php echo $movie->mv_dateadd->ViewAttributes() ?>><?php echo $movie->mv_dateadd->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Status</td>
		<td<?php echo $movie->mv_status->CellAttributes() ?>>
<div<?php echo $movie->mv_status->ViewAttributes() ?>><?php echo $movie->mv_status->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableAltRow">
		<td class="ewTableHeader">Home Page</td>
		<td<?php echo $movie->mv_homepage->CellAttributes() ?>>
<div<?php echo $movie->mv_homepage->ViewAttributes() ?>><?php echo $movie->mv_homepage->ViewValue ?></div>
</td>
	</tr>
	<tr class="ewTableRow">
		<td class="ewTableHeader">Active</td>
		<td<?php echo $movie->mv_active->CellAttributes() ?>>
<div<?php echo $movie->mv_active->ViewAttributes() ?>><?php echo $movie->mv_active->ViewValue ?></div>
</td>
	</tr>
</table>
</form>
<p>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php include "footer.php" ?>
<?php

// If control is passed here, simply terminate the page without redirect
Page_Terminate();

// -----------------------------------------------------------------
//  Subroutine Page_Terminate
//  - called when exit page
//  - clean up connection and objects
//  - if url specified, redirect to url, otherwise end response
function Page_Terminate($url = "") {
	global $conn;

	// Page unload event, used in current page
	Page_Unload();

	// Global page unloaded event (in userfn*.php)
	Page_Unloaded();

	 // Close Connection
	$conn->Close();

	// Go to url if specified
	if ($url <> "") {
		ob_end_clean();
		header("Location: $url");
	}
	exit();
}
?>
<?php

// Load row based on key values
function LoadRow() {
	global $conn, $Security, $movie;
	$sFilter = $movie->SqlKeyFilter();
	if (!is_numeric($movie->id->CurrentValue)) {
		return FALSE; // Invalid key, exit
	}
	$sFilter = str_replace("@id@", ew_AdjustSql($movie->id->CurrentValue), $sFilter); // Replace key value

	// Call Row Selecting event
	$movie->Row_Selecting($sFilter);

	// Load sql based on filter
	$movie->CurrentFilter = $sFilter;
	$sSql = $movie->SQL();
	if ($rs = $conn->Execute($sSql)) {
		if ($rs->EOF) {
			$LoadRow = FALSE;
		} else {
			$LoadRow = TRUE;
			$rs->MoveFirst();
			LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$movie->Row_Selected($rs);
		}
		$rs->Close();
	} else {
		$LoadRow = FALSE;
	}
	return $LoadRow;
}

// Load row values from recordset
function LoadRowValues(&$rs) {
	global $movie;
	$movie->id->setDbValue($rs->fields('id'));
	$movie->mv_id->setDbValue($rs->fields('mv_id'));
	$movie->parent_id->setDbValue($rs->fields('parent_id'));
	$movie->sub_id->setDbValue($rs->fields('sub_id'));
	$movie->mv_name->setDbValue($rs->fields('mv_name'));
	$movie->mv_name_en->setDbValue($rs->fields('mv_name_en'));
	$movie->mv_smallimg->Upload->DbValue = $rs->fields('mv_smallimg');
	$movie->mv_bigimg->Upload->DbValue = $rs->fields('mv_bigimg');
	$movie->mv_content->setDbValue($rs->fields('mv_content'));
	$movie->mv_detail->setDbValue($rs->fields('mv_detail'));
	$movie->mv_harddisk->setDbValue($rs->fields('mv_harddisk'));
	$movie->mv_path->setDbValue($rs->fields('mv_path'));
	$movie->mv_capacity->setDbValue($rs->fields('mv_capacity'));
	$movie->mv_year->setDbValue($rs->fields('mv_year'));
	$movie->mv_subtitles->setDbValue($rs->fields('mv_subtitles'));
	$movie->mv_resolution->setDbValue($rs->fields('mv_resolution'));
	$movie->mv_price->setDbValue($rs->fields('mv_price'));
	$movie->mv_dateadd->setDbValue($rs->fields('mv_dateadd'));
	$movie->mv_status->setDbValue($rs->fields('mv_status'));
	$movie->mv_homepage->setDbValue($rs->fields('mv_homepage'));
	$movie->mv_active->setDbValue($rs->fields('mv_active'));
}
?>
<?php

// Render row values based on field settings
function RenderRow() {
	global $conn, $Security, $movie;

	// Call Row Rendering event
	$movie->Row_Rendering();

	// Common render codes for all row types
	// id

	$movie->id->CellCssStyle = "";
	$movie->id->CellCssClass = "";

	// mv_id
	$movie->mv_id->CellCssStyle = "";
	$movie->mv_id->CellCssClass = "";

	// parent_id
	$movie->parent_id->CellCssStyle = "";
	$movie->parent_id->CellCssClass = "";

	// sub_id
	$movie->sub_id->CellCssStyle = "";
	$movie->sub_id->CellCssClass = "";

	// mv_name
	$movie->mv_name->CellCssStyle = "";
	$movie->mv_name->CellCssClass = "";

	// mv_name_en
	$movie->mv_name_en->CellCssStyle = "";
	$movie->mv_name_en->CellCssClass = "";

	// mv_smallimg
	$movie->mv_smallimg->CellCssStyle = "";
	$movie->mv_smallimg->CellCssClass = "";

	// mv_bigimg
	$movie->mv_bigimg->CellCssStyle = "";
	$movie->mv_bigimg->CellCssClass = "";

	// mv_content
	$movie->mv_content->CellCssStyle = "";
	$movie->mv_content->CellCssClass = "";

	// mv_detail
	$movie->mv_detail->CellCssStyle = "";
	$movie->mv_detail->CellCssClass = "";

	// mv_harddisk
	$movie->mv_harddisk->CellCssStyle = "";
	$movie->mv_harddisk->CellCssClass = "";

	// mv_path
	$movie->mv_path->CellCssStyle = "";
	$movie->mv_path->CellCssClass = "";

	// mv_capacity
	$movie->mv_capacity->CellCssStyle = "";
	$movie->mv_capacity->CellCssClass = "";

	// mv_year
	$movie->mv_year->CellCssStyle = "";
	$movie->mv_year->CellCssClass = "";

	// mv_subtitles
	$movie->mv_subtitles->CellCssStyle = "";
	$movie->mv_subtitles->CellCssClass = "";

	// mv_resolution
	$movie->mv_resolution->CellCssStyle = "";
	$movie->mv_resolution->CellCssClass = "";

	// mv_price
	$movie->mv_price->CellCssStyle = "";
	$movie->mv_price->CellCssClass = "";

	// mv_dateadd
	$movie->mv_dateadd->CellCssStyle = "";
	$movie->mv_dateadd->CellCssClass = "";

	// mv_status
	$movie->mv_status->CellCssStyle = "";
	$movie->mv_status->CellCssClass = "";

	// mv_homepage
	$movie->mv_homepage->CellCssStyle = "";
	$movie->mv_homepage->CellCssClass = "";

	// mv_active
	$movie->mv_active->CellCssStyle = "";
	$movie->mv_active->CellCssClass = "";
	if ($movie->RowType == EW_ROWTYPE_VIEW) { // View row

		// id
		$movie->id->ViewValue = $movie->id->CurrentValue;
		$movie->id->CssStyle = "";
		$movie->id->CssClass = "";
		$movie->id->ViewCustomAttributes = "";

		// mv_id
		$movie->mv_id->ViewValue = $movie->mv_id->CurrentValue;
		$movie->mv_id->CssStyle = "";
		$movie->mv_id->CssClass = "";
		$movie->mv_id->ViewCustomAttributes = "";

		// parent_id
		if (strval($movie->parent_id->CurrentValue) <> "") {
			$sSqlWrk = "SELECT `parent_name` FROM `parent` WHERE `parent_id` = " . ew_AdjustSql($movie->parent_id->CurrentValue) . "";
			$sSqlWrk .= " ORDER BY `parent_order` Desc";
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk) {
				if (!$rswrk->EOF) {
					$movie->parent_id->ViewValue = $rswrk->fields('parent_name');
				}
				$rswrk->Close();
			} else {
				$movie->parent_id->ViewValue = $movie->parent_id->CurrentValue;
			}
		} else {
			$movie->parent_id->ViewValue = NULL;
		}
		$movie->parent_id->CssStyle = "";
		$movie->parent_id->CssClass = "";
		$movie->parent_id->ViewCustomAttributes = "";

		// sub_id
		if (strval($movie->sub_id->CurrentValue) <> "") {
			$sSqlWrk = "SELECT `sub_name` FROM `subcat` WHERE `sub_id` = " . ew_AdjustSql($movie->sub_id->CurrentValue) . "";
			$sSqlWrk .= " AND (" . "`sub_type`='4'" . ")";
			$sSqlWrk .= " ORDER BY `sub_order` Desc";
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk) {
				if (!$rswrk->EOF) {
					$movie->sub_id->ViewValue = $rswrk->fields('sub_name');
				}
				$rswrk->Close();
			} else {
				$movie->sub_id->ViewValue = $movie->sub_id->CurrentValue;
			}
		} else {
			$movie->sub_id->ViewValue = NULL;
		}
		$movie->sub_id->CssStyle = "";
		$movie->sub_id->CssClass = "";
		$movie->sub_id->ViewCustomAttributes = "";

		// mv_name
		$movie->mv_name->ViewValue = $movie->mv_name->CurrentValue;
		$movie->mv_name->CssStyle = "";
		$movie->mv_name->CssClass = "";
		$movie->mv_name->ViewCustomAttributes = "";

		// mv_name_en
		$movie->mv_name_en->ViewValue = $movie->mv_name_en->CurrentValue;
		$movie->mv_name_en->CssStyle = "";
		$movie->mv_name_en->CssClass = "";
		$movie->mv_name_en->ViewCustomAttributes = "";

		// mv_smallimg
		if (!is_null($movie->mv_smallimg->Upload->DbValue)) {
			$movie->mv_smallimg->ViewValue = $movie->mv_smallimg->Upload->DbValue;
			$movie->mv_smallimg->ImageWidth = 100;
			$movie->mv_smallimg->ImageHeight = 100;
			$movie->mv_smallimg->ImageAlt = "";
		} else {
			$movie->mv_smallimg->ViewValue = "";
		}
		$movie->mv_smallimg->CssStyle = "";
		$movie->mv_smallimg->CssClass = "";
		$movie->mv_smallimg->ViewCustomAttributes = "";

		// mv_bigimg
		if (!is_null($movie->mv_bigimg->Upload->DbValue)) {
			$movie->mv_bigimg->ViewValue = $movie->mv_bigimg->Upload->DbValue;
			$movie->mv_bigimg->ImageWidth = 200;
			$movie->mv_bigimg->ImageHeight = 200;
			$movie->mv_bigimg->ImageAlt = "";
		} else {
			$movie->mv_bigimg->ViewValue = "";
		}
		$movie->mv_bigimg->CssStyle = "";
		$movie->mv_bigimg->CssClass = "";
		$movie->mv_bigimg->ViewCustomAttributes = "";

		// mv_content
		$movie->mv_content->ViewValue = $movie->mv_content->CurrentValue;
		if (!is_null($movie->mv_content->ViewValue)) $movie->mv_content->ViewValue = str_replace("\n", "<br>", $movie->mv_content->ViewValue); 
		$movie->mv_content->CssStyle = "";
		$movie->mv_content->CssClass = "";
		$movie->mv_content->ViewCustomAttributes = "";

		// mv_detail
		$movie->mv_detail->ViewValue = $movie->mv_detail->CurrentValue;
		if (!is_null($movie->mv_detail->ViewValue)) $movie->mv_detail->ViewValue = str_replace("\n", "<br>", $movie->mv_detail->ViewValue); 
		$movie->mv_detail->CssStyle = "";
		$movie->mv_detail->CssClass = "";
		$movie->mv_detail->ViewCustomAttributes = "";

		// mv_harddisk
		$movie->mv_harddisk->ViewValue = $movie->mv_harddisk->CurrentValue;
		$movie->mv_harddisk->CssStyle = "";
		$movie->mv_harddisk->CssClass = "";
		$movie->mv_harddisk->ViewCustomAttributes = "";

		// mv_path
		$movie->mv_path->ViewValue = $movie->mv_path->CurrentValue;
		$movie->mv_path->CssStyle = "";
		$movie->mv_path->CssClass = "";
		$movie->mv_path->ViewCustomAttributes = "";

		// mv_capacity
		$movie->mv_capacity->ViewValue = $movie->mv_capacity->CurrentValue;
		$movie->mv_capacity->CssStyle = "";
		$movie->mv_capacity->CssClass = "";
		$movie->mv_capacity->ViewCustomAttributes = "";

		// mv_year
		$movie->mv_year->ViewValue = $movie->mv_year->CurrentValue;
		$movie->mv_year->ViewValue = ew_FormatNumber($movie->mv_year->ViewValue, 0, -2, -2, -2);
		$movie->mv_year->CssStyle = "";
		$movie->mv_year->CssClass = "";
		$movie->mv_year->ViewCustomAttributes = "";

		// mv_subtitles
		$movie->mv_subtitles->ViewValue = $movie->mv_subtitles->CurrentValue;
		$movie->mv_subtitles->CssStyle = "";
		$movie->mv_subtitles->CssClass = "";
		$movie->mv_subtitles->ViewCustomAttributes = "";

		// mv_resolution
		$movie->mv_resolution->ViewValue = $movie->mv_resolution->CurrentValue;
		$movie->mv_resolution->CssStyle = "";
		$movie->mv_resolution->CssClass = "";
		$movie->mv_resolution->ViewCustomAttributes = "";

		// mv_price
		if (strval($movie->mv_price->CurrentValue) <> "") {
			$sSqlWrk = "SELECT `pr_price` FROM `price` WHERE `pr_id` = " . ew_AdjustSql($movie->mv_price->CurrentValue) . "";
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk) {
				if (!$rswrk->EOF) {
					$movie->mv_price->ViewValue = $rswrk->fields('pr_price');
				}
				$rswrk->Close();
			} else {
				$movie->mv_price->ViewValue = $movie->mv_price->CurrentValue;
			}
		} else {
			$movie->mv_price->ViewValue = NULL;
		}
		$movie->mv_price->CssStyle = "";
		$movie->mv_price->CssClass = "";
		$movie->mv_price->ViewCustomAttributes = "";

		// mv_dateadd
		$movie->mv_dateadd->ViewValue = $movie->mv_dateadd->CurrentValue;
		$movie->mv_dateadd->ViewValue = ew_FormatDateTime($movie->mv_dateadd->ViewValue, 7);
		$movie->mv_dateadd->CssStyle = "";
		$movie->mv_dateadd->CssClass = "";
		$movie->mv_dateadd->ViewCustomAttributes = "";

		// mv_status
		if (strval($movie->mv_status->CurrentValue) <> "") {
			switch ($movie->mv_status->CurrentValue) {
				case "1":
					$movie->mv_status->ViewValue = "Phim HD";
					break;
				case "2":
					$movie->mv_status->ViewValue = "Phim bo";
					break;
				case "3":
					$movie->mv_status->ViewValue = "Phim khoa hoc - tai lieu";
					break;
				case "4":
					$movie->mv_status->ViewValue = "Ca nhac";
					break;
				default:
					$movie->mv_status->ViewValue = $movie->mv_status->CurrentValue;
			}
		} else {
			$movie->mv_status->ViewValue = NULL;
		}
		$movie->mv_status->CssStyle = "";
		$movie->mv_status->CssClass = "";
		$movie->mv_status->ViewCustomAttributes = "";

		// mv_homepage
		if (strval($movie->mv_homepage->CurrentValue) <> "") {
			$movie->mv_homepage->ViewValue = "";
			$arwrk = explode(",", strval($movie->mv_homepage->CurrentValue));
			for ($ari = 0; $ari < count($arwrk); $ari++) {
				switch (trim($arwrk[$ari])) {
					case "1":
						$movie->mv_homepage->ViewValue .= "Home Page";
						break;
					default:
						$movie->mv_homepage->ViewValue .= trim($arwrk[$ari]);
				}
				if ($ari < count($arwrk)-1) $movie->mv_homepage->ViewValue .= ew_ViewOptionSeparator($ari);
			}
		} else {
			$movie->mv_homepage->ViewValue = NULL;
		}
		$movie->mv_homepage->CssStyle = "";
		$movie->mv_homepage->CssClass = "";
		$movie->mv_homepage->ViewCustomAttributes = "";

		// mv_active
		if (strval($movie->mv_active->CurrentValue) <> "") {
			$movie->mv_active->ViewValue = "";
			$arwrk = explode(",", strval($movie->mv_active->CurrentValue));
			for ($ari = 0; $ari < count($arwrk); $ari++) {
				switch (trim($arwrk[$ari])) {
					case "1":
						$movie->mv_active->ViewValue .= "Active";
						break;
					default:
						$movie->mv_active->ViewValue .= trim($arwrk[$ari]);
				}
				if ($ari < count($arwrk)-1) $movie->mv_active->ViewValue .= ew_ViewOptionSeparator($ari);
			}
		} else {
			$movie->mv_active->ViewValue = NULL;
		}
		$movie->mv_active->CssStyle = "";
		$movie->mv_active->CssClass = "";
		$movie->mv_active->ViewCustomAttributes = "";

		// id
		$movie->id->HrefValue = "";

		// mv_id
		$movie->mv_id->HrefValue = "";

		// parent_id
		$movie->parent_id->HrefValue = "";

		// sub_id
		$movie->sub_id->HrefValue = "";

		// mv_name
		$movie->mv_name->HrefValue = "";

		// mv_name_en
		$movie->mv_name_en->HrefValue = "";

		// mv_smallimg
		$movie->mv_smallimg->HrefValue = "";

		// mv_bigimg
		$movie->mv_bigimg->HrefValue = "";

		// mv_content
		$movie->mv_content->HrefValue = "";

		// mv_detail
		$movie->mv_detail->HrefValue = "";

		// mv_harddisk
		$movie->mv_harddisk->HrefValue = "";

		// mv_path
		$movie->mv_path->HrefValue = "";

		// mv_capacity
		$movie->mv_capacity->HrefValue = "";

		// mv_year
		$movie->mv_year->HrefValue = "";

		// mv_subtitles
		$movie->mv_subtitles->HrefValue = "";

		// mv_resolution
		$movie->mv_resolution->HrefValue = "";

		// mv_price
		$movie->mv_price->HrefValue = "";

		// mv_dateadd
		$movie->mv_dateadd->HrefValue = "";

		// mv_status
		$movie->mv_status->HrefValue = "";

		// mv_homepage
		$movie->mv_homepage->HrefValue = "";

		// mv_active
		$movie->mv_active->HrefValue = "";
	} elseif ($movie->RowType == EW_ROWTYPE_ADD) { // Add row
	} elseif ($movie->RowType == EW_ROWTYPE_EDIT) { // Edit row
	} elseif ($movie->RowType == EW_ROWTYPE_SEARCH) { // Search row
	}

	// Call Row Rendered event
	$movie->Row_Rendered();
}
?>
<?php

// Set up Starting Record parameters based on Pager Navigation
function SetUpStartRec() {
	global $nDisplayRecs, $nStartRec, $nTotalRecs, $nPageNo, $movie;
	if ($nDisplayRecs == 0) return;

	// Check for a START parameter
	if (@$_GET[EW_TABLE_START_REC] <> "") {
		$nStartRec = $_GET[EW_TABLE_START_REC];
		$movie->setStartRecordNumber($nStartRec);
	} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
		$nPageNo = $_GET[EW_TABLE_PAGE_NO];
		if (is_numeric($nPageNo)) {
			$nStartRec = ($nPageNo-1)*$nDisplayRecs+1;
			if ($nStartRec <= 0) {
				$nStartRec = 1;
			} elseif ($nStartRec >= intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1) {
				$nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1;
			}
			$movie->setStartRecordNumber($nStartRec);
		} else {
			$nStartRec = $movie->getStartRecordNumber();
		}
	} else {
		$nStartRec = $movie->getStartRecordNumber();
	}

	// Check if correct start record counter
	if (!is_numeric($nStartRec) || $nStartRec == "") { // Avoid invalid start record counter
		$nStartRec = 1; // Reset start record counter
		$movie->setStartRecordNumber($nStartRec);
	} elseif (intval($nStartRec) > intval($nTotalRecs)) { // Avoid starting record > total records
		$nStartRec = intval(($nTotalRecs-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to last page first record
		$movie->setStartRecordNumber($nStartRec);
	} elseif (($nStartRec-1) % $nDisplayRecs <> 0) {
		$nStartRec = intval(($nStartRec-1)/$nDisplayRecs)*$nDisplayRecs+1; // Point to page boundary
		$movie->setStartRecordNumber($nStartRec);
	}
}
?>
<?php

// Page Load event
function Page_Load() {

	//echo "Page Load";
}

// Page Unload event
function Page_Unload() {

	//echo "Page Unload";
}
?>
